<template>
  <div class="stat-card">
    <div class="stat-icon" :style="{ backgroundColor: color }">
      <i :class="icon"></i>
    </div>
    <div class="stat-info">
      <h3>{{ value }}</h3>
      <p>{{ title }}</p>
    </div>
  </div>
</template>

<script setup>
import { defineProps } from 'vue';

defineProps({
  icon: {
    type: String,
    required: true,
  },
  title: {
    type: String,
    required: true,
  },
  value: {
    type: [String, Number],
    required: true,
  },
  color: {
    type: String,
    default: '#ff9800', /* 默认颜色改为橙色 */
  },
});
</script>

<style scoped>
.stat-card {
  background: white;
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  gap: 20px;
  transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: white;
  flex-shrink: 0;
}

.stat-info h3 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 5px;
  color: #2c3e50;
}

.stat-info p {
  color: #777;
  font-size: 14px;
  margin: 0;
}
</style>